<link rel="stylesheet" href="{MODULE_URL}template/mobile/default/qrcode/css/other.20160408_144407.min.css" />
<body class="pzList">
<script type="text/javascript" src="{MODULE_URL}template/mobile/default/qrcode/js/html2canvas.js?t={php echo time()}"></script>
<script>
function printById(id) {
  html2canvas(document.getElementById(id), {
    allowTaint : true,
    taintTest : false,
    onrendered : function(canvas) {
      canvas.id = "mycanvas";
      var dataUrl = canvas.toDataURL();
      //_qrcode._pzImgUrl = _._encode(dataUrl.replace(/data:image\/png;base64,/g, ''));
      //_qrcode._imgUpload();
      $(".pic_pz img").attr("src",dataUrl);
      _tc._show('tc_pz');
    }
  });
}
</script>
<script>
var _api3 = {};
_api3._pzImgUp = "";
_api3._joinQr = "{php echo $qr_url}";
var _info = {
		  _id: "{php echo $_W['openid']}",
		  _type: "party",
		  _uid: "{php echo $_W['openid']}",
		  _joinZt: "{php echo $_joinZt}"//1：拒绝报名、2：取消报名
		};
/**公用*/
var _= {
    _trim: function(text) {
        return text.replace(/(^\s*)|(\s*$)/g, "");
    },
    _len: function(text) {
        return text.replace(/[^\x00-\xff]/g, "aa").length;
    },
    _encode: function(text) {
        return escape(encodeURIComponent(text));
    },
    _htmlencode: function(text) {
        return text.replace(/\'/g, "&#39;")
            .replace(/\"/g, "&quot;")
            .replace(/</g, "&lt;")
            .replace(/>/g, "&gt;")
            .replace(/ /g, "&nbsp;")
            .replace(/\n\r/g, "<br>")
            .replace(/\r\n/g, "<br>")
            .replace(/\n/g, "<br>");
    },
    _htmlencodeReturn: function(text) {
        return text.replace(/&#39;/g, "\'")
        .replace(/&quot;/g, "\"")
        .replace(/&lt;/g, "<")
        .replace(/&gt;/g, ">")
        .replace(/&nbsp;/g, " ")
        .replace(/&amp;/g, "&");
    },
    _zero: function(n) {
        return n < 0 ? 0 : n;
    },
    _scroll: function() {
        return {
            x: $(document).scrollLeft() + $(window).scrollLeft(),
            y: $(document).scrollTop() + $(window).scrollTop()
        };
    },
    _client: function() {
        return {
            w: document.documentElement.scrollWidth,
            h: document.documentElement.scrollHeight,
            bw: $(window).width(),
            bh: $(window).height()
        };
    },
    _center: function(id) {
        var _top = _._zero(_._client().bh - $("#" + id).outerHeight()) / 2;
        var _left = _._zero(_._client().bw - $("#" + id).outerWidth()) / 2;

        $("#" + id).css({
            "top": _top + "px",
            "left": _left + "px"
        });
    },
    _isHide: function(id) {
        $("#" + id).css("display") == "none";
    }
};
/**用户*/
var _user= {
    _id: function() {
    	return $('#hide_openid').val();
    },
    _login: function() {
        return _user._id() != "";
    },
    _loginWithSnp: function(snp) {
    	var wulbu = location.href.toString();

        if(wulbu.indexOf("/login") == -1){
            _cookie._set("W_U_L_B_U", wulbu);
        }
        switch (snp) {
            case "weixin":
                _g(_user._inWeixin() ? _link._loginWithWeixin : _link._loginWithWeixinMp);
                break;
            case "qq":
                _g(_link._loginWithQq);
                break;
            case "weibo":
                _g(_link._loginWithWeibo);
                break;
			case 1:
			_g(_user._inWeixin() ? _link._loginWithWeixin : _link._loginWithWeixinMp);
			break;
        }
    },
    _setLogin: function(i, s) {
        _cookie._set("W_U_L_I", i, 60 * 60 * 24 * 365 * 10);
        _cookie._set("W_U_L_S", s, 60 * 60 * 24 * 365 * 10);
    },
    _error: function(state, type) {
        switch (state.toString()) {
            case "1004":
            case "1006":
            case "2310":
            case "2509":
            case "2709":
            case "2809":
            case "3014":
            case "5303":
            case "5910":
                _user._toLogin('');
                break;
            case "2304":
            case "2504":
            case "2704":
                _beforeLogin._mark("");
                break;
            case "2804":
                _option._setTemp("");
                break;
            case "5304":
                _likeBeforeLogin._mark("");
                break;
        }
    },
    _toLogin: function(id) {
    	if(id == undefined){id = "";}
        if (_user._inHudongba()) {
            HudongbaJsBridge["showLoginPage"]();
            return;
        }
        var wulbu = location.href.toString();
        //发布页链接单独保留参数，保存具体的发布类型
        if(wulbu.indexOf("/post/") > 0){
            var postParam = wulbu.substring(wulbu.lastIndexOf("?"), wulbu.length);
            _cookie._set("postParam", postParam);
        }
        wulbu = wulbu.indexOf("#") > 0 ? wulbu.substring(0, wulbu.indexOf("#")) : wulbu;
        if(wulbu.indexOf("pay/paysuccess")==-1){
            wulbu = wulbu.indexOf("?") > 0 ? wulbu.substring(0, wulbu.indexOf("?")) : wulbu;
          }
        if(wulbu.indexOf("/login") == -1 && wulbu.indexOf("/register") == -1){
            _cookie._set("W_U_L_B_U", wulbu);
        }else{
            _cookie._set("W_U_L_B_U", "");
        }
        if (_user._inWeixin() || _user._inQq()) {
            _login._show();
            return;
        }
        if (_user._inMobile()) {
            _g(_link._login + "?hdb_from=Wap" + id);
        } else {
            _g(_link._login + "?hdb_from=PC" + id);
        }
    },
    _toRegister: function(){
        var wulbu = location.href.toString();
        wulbu = wulbu.indexOf("#") > 0 ? wulbu.substring(0, wulbu.indexOf("#")) : wulbu;
        wulbu = wulbu.indexOf("?") > 0 ? wulbu.substring(0, wulbu.indexOf("?")) : wulbu;

        if(wulbu.indexOf("/register")==-1 && wulbu.indexOf("/login")==-1){
            _cookie._set("W_U_L_B_U", wulbu);
        }else{
            _cookie._set("W_U_L_B_U", "");
        }
        window.location.href = "/register";
    },
    _toLoginUrl: function(url) {
        if (_user._login()) {
            _g(url);
            return false;
        }
        _cookie._set("W_U_L_B_U", url);
        _g(_link._login);
    },
    _loginBack: function() {
        var url = _cookie._get("W_U_L_B_U");
        if(url.indexOf("/post/") > 0){
            url = url + _cookie._get("postParam");
        }
        _g(url == "" ? _link._loginBackDefault : url);
    },
    _toLogout: function() {
        if (window.localStorage) {
            window.localStorage.clear();
        }
        _cookie._set("W_U_L_I", "");
        _cookie._set("W_U_L_S", "");
        var wulbu = location.href.toString();
        wulbu = wulbu.indexOf("#") > 0 ? wulbu.substring(0, wulbu.indexOf("#")) : wulbu;
        if(wulbu.indexOf("pay/paysuccess")==-1){
          wulbu = wulbu.indexOf("?") > 0 ? wulbu.substring(0, wulbu.indexOf("?")) : wulbu;
        }
        _cookie._set("W_U_L_B_U", wulbu);
        _g(_link._login);
    },
    _inWeixin: function() {
        return navigator.userAgent.match(/micromessenger/i) != null;
    },
    _inQq: function() {
        return /(iPad|iPhone|iPod).*?QQ/g.test(navigator.userAgent) || /\bV1_AND_SQ_/.test(navigator.userAgent);
    },
    _inWeibo: function() {
        return navigator.userAgent.match(/weibo/i) != null;
    },
    _inHudongba: function() {
        return navigator.userAgent.match(/jootun\.hudongba/i) != null;
    },
    _inMobile: function() {
        return appInfo.pub_system == "mb";
    },
    _useIOs: function() {
        return navigator.userAgent.match(/ipad|iphone|ipod/i) != null;
    },
    _useAndroid: function() {
        return navigator.userAgent.match(/android/i) != null;
    },
    _isappinstalled: function() {
        return _cookie._get("IS") == "1";
    },
    _init: function() {
		if(null!=$("#post_page_unionstate")){
			if (!_user._login()) {
				$("#a_login").hide();
				$("#a_top_login").show();
				$("#a_top_register").show();
			}else{
			  $("#a_top_register").hide();
			  $("#a_top_login").hide();
			  $("#a_login").show(); 
			}
		 }
        if (_user._inWeixin()) {
            if (location.href.toString().match(/isappinstalled=1/i) != null) {
                _cookie._set("IS", "1", 60 * 60 * 24 * 30);
            }
            $("#login_button").html("<div class='button_5' ontouchstart='' onclick='_user._loginWithSnp(1)'><p><img width='25' height='20' src='" + _imgCdn + "/images/icon_weixin_2.png'><span>一键登录</span></p></div>");
        } else if (_user._inQq()) {
            $("#login_button").html("<div class='button_6' ontouchstart='' onclick='_g(_link._loginWithQq)'><p><img width='20' height='20' src='" + _imgCdn + "/images/icon_qq.png'><span>QQ登录</span></p></div>");
        }
        if (_user._login()) {
        	$(".mem_r").show();
            $(".mem_r2").hide();
            $(".mem_l").css("margin-right",155+"px");
            $("#dt_review").find("div[name='discuss_icon_1']").find("a").each(function(){
                $(this).attr("href", "/timeline/" + _user._id());
            });
            $("#dt_review").find("div[name='discuss_icon_1']").show();
        } else {
            $("#dt_review").find("div[name='discuss_icon_0']").show();
            $("#a_top_login").html("登录");
            $("#a_top_register").html("注册");
            $("#a_top_user,#a_top_login_out,#loginAfter,#loginAfter_a").hide();
            $("#loginBefore_a").css({
                "display": "block"
            });
            $(".mem_l").css("margin-right",0+"px");
        }
        $('body>*').each(function(index, element) {
            var item = $(element);
            item.css('zIndex') > 15000 && item.remove();
        });
    }
};
/**后面的蒙板*/
var _cover= {
    _flag: false,
    _resize: function(id) {
        var _width = (_._client().w > _._client().bw ? _._client().w : _._client().bw) + "px";
        var _height = (_._client().h > _._client().bh ? _._client().h : _._client().bh) + "px";
        $("#" + id).css({
            "width": _width,
            "height": _height
        });
    },
    _resizeAll: function() {
        if ($("#cover2")) {
            _cover._resize("cover2");
        }
        _cover._resize("cover");
    },
    _show: function(id) {
        _cover._flag = true;
        $("#" + id).show();
        if (_user._useIOs()) {
            _cover._resizeAll();
            $(window).bind("resize", "", _cover._resizeAll);
            $(window).bind("scroll", "", _cover._resizeAll);
        } else {
            $("#" + id).css({
                "position": "fixed",
                "width": "100%",
                "height": "100%"
            });
        }
    },
    _hide: function(id) {
        $("#" + id).hide();
        _cover._flag = false;
        if (($("#cover2") && !_._isHide("cover2")) || !_._isHide("cover")) {
            return;
        };
        if (!_user._useIOs()) {
            return;
        }
        $(window).unbind("resize");
        $("#" + id).unbind("click");
    }
};
/**加载*/
var _loading= {
    _center: function() {
        var y = $(window).height();
        var w = $("body").width();
        $(".loadingDiv").css({
            "left": (w - 120) / 2 + "px",
            "top": (y - 120) / 2 + "px",
            "z-index": 10000
        });
    },
    _show: function(text) {
        _loading._center();
        $("#cover").css({
            "background-color": "#ffffff",
            "opacity": 0
        });
        _cover._show("cover");
        $(".loadingDiv .pTxt").html(text);
        $(".loadingDiv").show();
        $(window).bind("resize", "", _loading._center);
    },
    _hide: function() {
        _cover._hide("cover");
        $(".loadingDiv").hide();
        $("#cover").css({
            "background-color": "#000000",
            "opacity": 0.7
        });
    }
};

/*公共弹窗*/
var _tc= {
    _id: "",
    _center: function() {
        var _top = _._zero(_._client().bh - $("#" + _tc._id).outerHeight()) / 2 + "px";
        var _left = _._zero(_._client().bw - $("#" + _tc._id).outerWidth()) / 2 + "px";
        $("#" + _tc._id).css({
            "left": _left,
            "top": _top,
            "z-index": "3000",
            "position": "fixed"
        });
    },
    _show: function(id) {
        _tc._id = id;
        $("#" + _tc._id).show();
        _cover._show("cover2");
        $("#cover2").bind("click", _tc._hide);
        _tc._center();
        $(window).bind("resize", _tc._center);
        _cover._show("cover2");
    },
    _hide: function() {
        _cover._hide("cover2");
        $("#" + _tc._id).hide();
    }
};
var _qrcode={
  _pzImgUrl:"",
  _init:function(){
    if(true){
      $(".noPay .tc_c_ts").hide();
      return;
    }
  },
  _down:function(){
    _loading._show("加载中");
    $('html, body').animate({
      scrollTop: 0
    }, 300, function(){
      _loading._hide();
      printById('pzJuan');
    });
  },
  _pd:function(){
	  $("#dzj_out").show();
      $("#dzj_out_ts").hide();
  },
  _imgUpload:function(){
    _$(_api3._pzImgUp,"infoType=qr&base64Str="+_qrcode._pzImgUrl,_qrcode._imgUploadOk);
  },
  _imgUploadOk:function(json,code){
    if (code != 200) {
      _toast._show('保存失败，请重新操作！')
      return;
    }
    $(".pic_pz img").attr("src",json.url);
    _tc._show('tc_pz');
    _loading._hide();
  }
}
require(['jquery'],function($){
	
	$(document).ready(function () {
		  _qrcode._pd();
		  var _url = _api3._joinQr;
		  $("#ticket_img_src").attr("src", _url);
		  _qrcode._init();
		  var h = $(window).height();
		  $("#dzj_out_join_check .img").css("padding-top",(h-209)/2.5+"px");
	});
});
</script>
<input id="hide_openid" type="hidden" name="openid" value="{php echo $_W['openid']}"/>

<div id="div_topbar_title" style="display: none">收货凭证</div>
<div id="dzj_out" style="display:none;">
  <div class="pzJuan_outside">
    <i><img src="{MODULE_URL}template/mobile/default/qrcode/images/other/xf_bian_03_n2.png" /></i>
    <u></u>
    <div id="pzJuan" class="pay_n">
      <p class="ticket_tittle"><span>{$user['nickname']}的收货凭证<span><b></b></p>
      <p class="ticket_numMa">数字码：<span>{$tasks['code']}</span></p>
      <p class="ticket_img"><span><img id="ticket_img_src" src="{MODULE_URL}template/mobile/default/qrcode/images/other/loading_5.gif" alt="报名凭证二维码" /><span></p>
      <p class="ticket_tit"><span class="fee_num">{if $tasks['status'] == 1}待接单{else if $tasks['status']==2}已受理{else if $tasks['status'] == 4}已完成{/if}</span></p>
      <ul class="ticket_xq">
        <li>创建时间：<span>{php echo date('Y-m-d',$tasks['create_time'])}</span></li>
        <li>任务地点：<span>{$tasks['provice']} {$tasks['city']} {$tasks['street']} {$tasks['address']}</span></li>
        <li>任务主：<span>{php echo $user['nickname']}</span></li>
        {if !empty($tasks['desc'])}<p style="overflow:visable;background-color: #fff;">{php echo $tasks['desc']}</p>{/if}
      </ul>
      <div class="hdb_lg" style="width: 100%;"><span style="width: 100%;">电子凭证已自动保存至{$_W['account']['name']}</span></div>
    </div>
  </div>
  
  <div class="pz_cz">
    <a href="javascript:void(0)" ontouchstart="" onclick="_qrcode._down()">保存收货凭证</a>
    <a href="{php echo $this->createMobileUrl('detail',array('op'=>'index','id'=>$tasks['id']))}" ontouchstart="">查看任务</a>
  </div>
  
  <div class="pz_jianGe"><p><span>您还可以</span></p></div>
  
  <ul class="pz_other">
    <li><a href="{$_W['account']['subscribeurl']}"" ontouchstart=""><b class="ic_xin"></b><div><h4>关注{$_W['account']['name']}</h4><span>随时查看收货凭证，随时随地请帮手</span></div><i></i></a></li>
    <li><a href="{php echo $this->createMobileUrl('home')}" ontouchstart=""><b class="ic_xing"></b><div><h4>返回个人中心</h4><span>可以查看其它任务的收货凭证</span></div><i></i></a></li>
  </ul>
</div>
<div id="tc_pz" style="display:none;">
  <div class="close"><a href="javascript:void(0)" onclick="_tc._hide('tc_pz');"></a></div>
  <p class="title">保存收货凭证</p>
  <p class="pic_pz"><img src="{MODULE_URL}template/mobile/default/qrcode/images/other/yin_414.gif" /></p>
  <p class="ts_pz" style="color:#666;padding:2px 20px 10px">长按图片或手机截屏保存</p>
</div>
<div class="loadingDiv" id="loadingDiv" style="display:none;"><p class="pImg"><img src="{MODULE_URL}template/mobile/default/qrcode/images/other/loading2.gif" /></p><p class="pTxt"></p></div>
  <div id="cover"></div>
  <div id="cover2"></div>
  <div id="toast" class="toast"></div>
</body>
</html>